function DebuggerLoader() {
    var count = 0;
    function loadDebugger() {
        var eScript = document.createElement("script");
        eScript.src = "eruda.js";
        document.body.append(eScript);
        eScript.onload = function () {
            eruda.init();
            navigator.vibrate(3000);
        };
    }
    function triggerLoad(needTrrigerCount) {
        if (needTrrigerCount == null || needTrrigerCount == undefined) {
            needTrrigerCount = 10;
        }

        if (count < needTrrigerCount - 1) {
            count++;
            return;
        }
        count = 1;
        needTrrigerCount = 0;
        loadDebugger();
    }
    return {
        loadDebugger: loadDebugger,
        triggerLoad: triggerLoad,
    };
}

var debuggerLoader = DebuggerLoader();
window.onload = function () {
    document.getElementById("brand").onclick = function () {
        debuggerLoader.triggerLoad(3);
    };
};

(function () {
    var src = "eruda.js";
    if (
        !/eruda=true/.test(window.location) &&
        localStorage.getItem("active-eruda") != "true"
    )
        return;
    document.write("<scr" + 'ipt src="' + src + '"></scr' + "ipt>");
    document.write("<scr" + "ipt>eruda.init();</scr" + "ipt>");
})();
